package main

import (
	"context"
	"go.mongodb.org/mongo-driver/bson"
	"utilsx/db/mongoUtils"
)

var client = mongoUtils.CreatCon("root", "root", "192.168.20.9", "27017")
var database = client.Database("db_games_info")

/*
bson.D, internally is primitive.D, which is []primitive.E, which is a struct.
bson.M, internally is primitive.M, which is map[string]interface{}. You put in key/value in bson.M but use document (struct) in bson.D.
It is better to explain it using 2 parameters, e.g. search for a = 1 and b = 2. You syntax will be: bson.M{"a": 1, "b": 2} or bson.D{{"a": 1}, {"b": 2}}
*/
var DataFile = "/home/debi/IdeaProjects/EmpShop/Server/spider/SteamGameAll.json"
var TARGET_File = "/home/debi/IdeaProjects/EmpShop/Server/web/cmd/SteamGameSource.json"

func CreatDataBase() {
	coll := database.Collection("game_info")
	todo := context.TODO()
	coll.Drop(todo)
	mongoUtils.CreateIndex(coll, bson.D{{"appid", 1}})

}
